package com.yanqu.road.logic.pb;
import com.yanqu.road.entity.player.UserColdRoomSite;
import com.yanqu.road.pb.coldRoom.ColdRoomProto.*;

import java.util.List;

public class ColdRoomPb {
    public static ColdRoomSiteTempMsg.Builder parseColdRoomSiteTempMsg(UserColdRoomSite coldRoomSite) {
        if(null == coldRoomSite){
            return null;
        }
        ColdRoomSiteTempMsg.Builder msg = ColdRoomSiteTempMsg.newBuilder();
        msg.setSiteIndex(coldRoomSite.getSiteIndex());
        msg.setLastRestoreTime(coldRoomSite.getLastRestoreTime()/1000);
        msg.setBeautyId(coldRoomSite.getBeautyId());
        return msg;
    }

    public static ColdRoomSiteListMsg.Builder parseColdRoomSiteListMsg(List<UserColdRoomSite> userColdRoomSiteList){
        ColdRoomSiteListMsg.Builder listMsg = ColdRoomSiteListMsg.newBuilder();
        if(null != userColdRoomSiteList) {
            for (UserColdRoomSite site : userColdRoomSiteList) {
                ColdRoomSiteTempMsg.Builder msg = parseColdRoomSiteTempMsg(site);
                if (null != msg) {
                    listMsg.addColdRoomSiteList(msg);
                }
            }
        }
        return listMsg;
    }
}
